package com.xhwl.logistics.enums;

import lombok.Getter;

@Getter
public enum VehicleParkingLotHandlerEnum {

    VEHICLE_PARKINGLOT_NOTHING(-1, "vehicleParkingLotNothingHandlerImpl", "vehicleParkingLotNothingTokenHandlerImpl"),
    VEHICLE_PARKINGLOT_HUAWEIIOT(1, "vehicleParkingLotHuaWeiIOTHandlerImpl"),
    VEHICLE_PARKINGLOT_HAIKANG(2, "vehicleParkingLotHaiKangHandlerImpl"),
    VEHICLE_PARKINGLOT_KETOP(3, "vehicleParkingLotKeTopHandlerImpl"),
    VEHICLE_PARKINGLOT_CHEAN(22, "vehicleParkingLotCheAnHandlerImpl"),
    VEHICLE_PARKINGLOT_NANTOU(26, "vehicleParkingLotNanTouHandlerImpl"),
    VEHICLE_PARKINGLOT_LIFANG(92, "vehicleParkingLotLiFangHandlerImpl"),
    VEHICLE_PARKINGLOT_JIESHUN(29, "vehicleParkingLotJieShunHandlerImpl", "vehicleParkingLotJieShunTokenHandlerImpl"),
    VEHICLE_PARKINGLOT_COSON(52,"vehicleParkingLotCoSonHandlerImpl"),
    VEHICLE_PARKINGLOT_FUSHI(64,"vehicleParkingLotFuShiHandlerImpl");
    //由于多个环境中的产品id不是一样的，所以后面的枚举我采用动态增加枚举的想法，具体逻辑在InitEnumRunner类中。

    VehicleParkingLotHandlerEnum(Integer productId, String handlerName) {
        this(productId, handlerName, null);
//        this.productId = productId;
//        this.handlerName = handlerName;
//        this.tokenHandlerName = null;
    }

    VehicleParkingLotHandlerEnum(Integer productId, String handlerName, String tokenHandlerName) {
        this.productId = productId;
        this.handlerName = handlerName;
        this.tokenHandlerName = tokenHandlerName;
    }

    private final Integer productId;

    private final String handlerName;

    private final String tokenHandlerName;

    public static VehicleParkingLotHandlerEnum toVehicleParkingLotHandlerEnum(Integer productId) {
        for (VehicleParkingLotHandlerEnum vehicleParkingLotHandlerEnum : VehicleParkingLotHandlerEnum.values()) {
            if (vehicleParkingLotHandlerEnum.productId.equals(productId)) {
                return vehicleParkingLotHandlerEnum;
            }
        }
//        throw new IllegalArgumentException("非法的VehicleParkingLotHandlerEnum的productId，无法映射到对应的厂商");
        return VEHICLE_PARKINGLOT_NOTHING;
    }

}
